//
//   BattleshipGameCell.java
//  NetworkBattleship
//
//  Created by Alan Joyce on 12/17/06.
//  Copyright 2006 __MyCompanyName__. All rights reserved.
//
package gamefiles;

public class BattleshipGameCell {
//Declare variables.
	public static final int STATE_EMPTY = 0 ;
	public static final int STATE_SHIP = 1;
	public static final int STATE_EMPTY_HIT = 2;
	public static final int STATE_SHIP_HIT = 3;
	
	
	private int currentState;
	private int cellPlayer;
	
	
	public BattleshipGameCell() {
		currentState = STATE_EMPTY;
		cellPlayer = 0;
	}
	
	public BattleshipGameCell(int player) {
		currentState = STATE_EMPTY;
		cellPlayer = player;
	}
	
	
	public void shipCell() {
		currentState = STATE_SHIP;
	}
	
	
	public int fireCell() {
		if(currentState == STATE_EMPTY) {
			currentState = STATE_EMPTY_HIT;
			return 0;
		}
		else if(currentState == STATE_SHIP) {
			currentState = STATE_SHIP_HIT;
			return 1;
		}
		else {
			return -1;
		}
	}
	
	public int getState() {
		return currentState;
	}
	
	public int getPlayer() {
		return cellPlayer;
	}
	
	public int setState(int state) {
		currentState = state;
		return 0;
	}
	
	public void setPlayer(int player) {
		cellPlayer = player;
	}
}